webpackJsonp([10],{

/***/ "2J5o":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/extends.js
var helpers_extends = __webpack_require__("4YfN");
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/store/index.js
var store = __webpack_require__("IcnI");

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/apps/login/index.vue



//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//




/* harmony default export */ var login = ({
  name: 'page-login',

  data: function data() {
    return {
      rememberPassword: ['记住密码'],
      user: {
        username: Object(store["c" /* GetStore */])(store["f" /* Store */].user) ? Object(store["c" /* GetStore */])(store["f" /* Store */].user).username : '',
        password: localStorage.getItem('password') ? localStorage.getItem('password') : ''
      },
      rules: {
        username: {
          type: 'string',
          required: true,
          message: '用户名不能为空!'
        },
        password: { type: 'string', required: true, message: '密码不能为空!' }
      },
      clientHeight: '600px'
    };
  },
  mounted: function mounted() {
    // 动态设置背景高度，即使键盘上去元素高度还是不会改变
    this.clientHeight = document.documentElement.clientHeight + 'px';
  },

  methods: {
    doLogin: function doLogin(loaded) {
      var _this = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
        var _ref, user, roles, enterprise, organization;

        return regenerator_default.a.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                _context.prev = 0;
                _context.next = 3;
                return commonApi["a" /* commonApi */].login(_this.user);

              case 3:
                _context.next = 5;
                return commonApi["a" /* commonApi */].runCloud('getUserInfo');

              case 5:
                _ref = _context.sent;
                user = _ref.user;
                roles = _ref.roles;
                enterprise = _ref.enterprise;
                organization = _ref.organization;


                // 这里单独使用 localStorage存储，与全局方法 SetStore 方式不统一
                if (_this.rememberPassword.length) {
                  localStorage.setItem('password', _this.user.password);
                } else {
                  localStorage.getItem('password') ? localStorage.removeItem('password') : null;
                }

                Object(store["e" /* SetStore */])(store["f" /* Store */].user, user);
                Object(store["e" /* SetStore */])(store["f" /* Store */].roles, roles);
                Object(store["e" /* SetStore */])(store["f" /* Store */].enterprise, enterprise);
                Object(store["e" /* SetStore */])(store["f" /* Store */].organization, organization ? extends_default()({ id: organization.id }, organization.attributes) : null);
                _this.$Toast('登录成功!');
                _this.$router.$push('/home');
                _context.next = 22;
                break;

              case 19:
                _context.prev = 19;
                _context.t0 = _context['catch'](0);

                _this.$Toast('密码错误!', 'error');

              case 22:
                loaded();

              case 23:
              case 'end':
                return _context.stop();
            }
          }
        }, _callee, _this, [[0, 19]]);
      }))();
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-51f54838","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/apps/login/index.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"yt-page"},[_c('img',{staticClass:"form-bg",style:(("height: " + _vm.clientHeight)),attrs:{"src":__webpack_require__("Uycq")}}),_vm._v(" "),_c('yt-form',{staticClass:"form",attrs:{"rules":_vm.rules,"model":_vm.user}},[_c('div',{staticClass:"form-box"},[_c('yt-input',{staticClass:"form-input",attrs:{"type":"text","placeholder":"请输入账号","fillColor":"transparent","theme":"light","align":"left","border":""},model:{value:(_vm.user.username),callback:function ($$v) {_vm.$set(_vm.user, "username", $$v)},expression:"user.username"}})],1),_vm._v(" "),_c('div',{staticClass:"form-box"},[_c('yt-input',{staticClass:"form-input",attrs:{"type":"password","placeholder":"请输入密码","fillColor":"transparent","theme":"light","align":"left","border":""},model:{value:(_vm.user.password),callback:function ($$v) {_vm.$set(_vm.user, "password", $$v)},expression:"user.password"}})],1),_vm._v(" "),_c('yt-checkBox',{attrs:{"name":"记住密码"},model:{value:(_vm.rememberPassword),callback:function ($$v) {_vm.rememberPassword=$$v},expression:"rememberPassword"}},[_c('span',{staticStyle:{"color":"white","font-size":"12px"}},[_vm._v("记住密码")])]),_vm._v(" "),_c('yt-btn',{staticClass:"form-btn",staticStyle:{"background-color":"#35ca98"},attrs:{"validator":"","loading":_vm.doLogin}},[_vm._v("\n      登录\n    ")])],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var apps_login = (esExports);
// CONCATENATED MODULE: ./src/apps/login/index.vue
function injectStyle (ssrContext) {
  __webpack_require__("VYed")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-51f54838"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  login,
  apps_login,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var src_apps_login = __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ "Uycq":
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__.p + "static/img/bg.27256f2.jpg";

/***/ }),

/***/ "VYed":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ })

});